package net.lovesrc.allin.biz.dida;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ListingHolder implements Comparable<ListingHolder> {

    private Listing origin;

    private int startDistance;

    private int endDistance;

    private String dayText;

    private String startTime;

    private String endTime;

    public ListingHolder(Listing origin) {
        this.origin = origin;
    }

    @Override
    public int compareTo(ListingHolder o) {
        return startDistance == o.getStartDistance() ? 1 : startDistance - o.getStartDistance();
    }

    @Override
    public int hashCode() {
        return origin.hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof ListingHolder)) {
            return false;
        }
        return ((ListingHolder) o).origin.equals(origin);
    }

}
